import { User } from "screens/project-list/search-panel";
import { useHttp } from "./http";
import { clearObject, useMount } from "./index";
import { useAsync } from "./use-async";

export const useUsers = (param?: Partial<User>) => {
  const client = useHttp()
  const {run, ...result} = useAsync<User[]>()
  useMount(() => {
    run(client('users', {data: clearObject(param || {})}))
  })
  return result
}
